/**
 * Mar 24, 2014 1:54:09 PM
 */
package elitech.vietnam.weatherfashion.widget;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.PopupWindow;
import elitech.vietnam.weatherfashion.MainActivity;
import elitech.vietnam.weatherfashion.R;
import elitech.vietnam.weatherfashion.WFApplication;
import elitech.vietnam.weatherfashion.notification.NotificationArrayAdapter;

/**
 * @author Cong
 *
 */
public class NotificationWindow extends PopupWindow {

	private MainActivity mContext;
	
	ListView mListView;
	NotificationArrayAdapter mAdapter;
	
	public NotificationWindow(Context context) {
		super(context);
		init(context);
	}

	void init(Context context) {
		mContext = (MainActivity) context;
		setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
		setContentView(LayoutInflater.from(context).inflate(R.layout.notification_window, null));
		mListView = (ListView) getContentView().findViewById(R.id.notiListview);
//		mTextView = (TextView) getContentView().findViewById(R.id.notiTextNoData);
//		mProgress = (ProgressBar) getContentView().findViewById(R.id.notiProgress);
		
//		mListView.setLoadingView(R.layout.layout_loadmore);
		mAdapter = new NotificationArrayAdapter(mContext, R.layout.notification_list_item, 0, WFApplication.getInstance().mListNoti);
		mListView.setAdapter(mAdapter);
//		mListView.setListener(this);
//		mListView.setOnItemClickListener(mAdapter);
		
//		if (mAdapter.getCount() > 0)
//			setLoading(false);
//		if (mAdapter.getCount() < Const.NOTIFICATION_PER_LOAD)
//			endOfList();
//		
//		setOutsideTouchable(true);
		setFocusable(true);
	}
}
